import Login from '../components/layout/Login.vue';
import Layout from '../components/layout/index.vue';

/**
 * meta除了原生参数外可配置的参数:
 * meta: {
 *  title: { String|Number|Function }
 *         显示在侧边栏、面包屑和标签栏的文字
 *         使用'{{ 多语言字段 }}'形式结合多语言使用，例子看多语言的路由配置;
 *         可以传入一个回调函数，参数是当前路由对象，例子看动态路由和带参路由
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  noCache: (false) 设为true后页面在切换标签后不会缓存，如果需要缓存，无需设置这个字段，而且需要设置页面组件name属性和路由配置的name一致
 *  access: (null)[array] 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单，如果是自定义图标，需要在图标名称前加下划线'_'
 * }
 */

export default [
    {
        path: '/',
        redirect: '/login',
        meta: {
            hideInMenu: true,
        },
    },
    {
        path: '/login',
        name: 'login',
        component: Login,
        meta: {
            title: '登录',
            hideInMenu: true,
            noCache: true,
        },
    },
    {
        path: '/home',
        name: 'home',
        redirect: '/home/homePage',
        component: Layout,
        meta: {
            title: '首页',
            noCache: true,
            hideInMenu: true,
        },
        children: [
            {
                path: 'homePage',
                name: 'homePage',
                component: () => import('../views/a-home/HomePage.vue'),
                meta: {
                    title: '首页展示',
                    noCache: true,
                    // access: ['admin'],
                },
            },
        ],
    },
    {
        path: '/account',
        name: 'account',
        component: Layout,
        meta: {
            title: '用户管理',
            icon: 'icon-drxx10',
            access: ['admin'],
        },
        children: [
            {
                path: 'permission',
                name: 'permission',
                component: () => import(/* webpackChunkName: "account" */ '../views/account/permission/Permission.vue'),
                meta: {
                    title: '用户权限',
                    noCache: true,
                    access: ['superAdmin'],
                },
            },
            {
                path: 'optionTwo',
                name: 'optionTwo',
                component: () => import(/* webpackChunkName: "account" */ '../views/account/optionTwo/OptionTwo.vue'),
                meta: {
                    title: '选项二',
                    noCache: false,
                    access: ['admin'],
                },
            },
        ],
    },
    {
        path: '/components',
        name: 'components',
        meta: {
            title: '组件',
            icon: 'icon-tongji',
            access: ['components'],
        },
        component: Layout,
        children: [
            {
                path: 'imgZip',
                name: 'imgZip',
                meta: {
                    title: '照片压缩',
                    access: ['admin'],
                    href: 'https://my.oschina.net/yangyishe/blog/3055732',
                },
                component: () => import(/* webpackChunkName: "components" */ '@/views/components/imgZip'),
            },
            {
                path: 'drag_list_page',
                name: 'drag_list_page',
                meta: {
                    title: '拖拽列表',
                    access: ['admin'],
                },
                component: () => import(/* webpackChunkName: "components" */ '@/views/components/drag-list')
            },
        ],
    },
    {
        path: '/401',
        name: 'error_401',
        meta: {
            hideInMenu: true,
        },
        component: () => import('@/views/error-page/401.vue'),
    },
    {
        path: '/500',
        name: 'error_500',
        meta: {
            hideInMenu: true,
        },
        component: () => import('@/views/error-page/500.vue'),
    },
    {
        path: '*',
        name: 'error_404',
        meta: {
            hideInMenu: true,
        },
        component: () => import('@/views/error-page/404.vue'),
    },
];
